<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // var arr=['a','a','a','b','b','c','c','c','c','d','d','d','d'];
        // var thing={};
        // for (var i = 0;i<=arr.length;i++){
        //    thing[i] = arr[i];
        //    thing.length = arr.length;
        // }
        // console.log(thing);

        // 13.数组转对象
        // var arr=['a','a','a','b','b','c','c','c','c','d','d','d','d'];
        // var thing={};
        // for (var i = 0;i<arr.length;i++){
        //    thing[i] = arr[i];
        //    thing.length = arr.length;
        // }
        // console.log(thing);


        // 13.数组转对象
        var arr=['a','a','a','b','b','c','c','c','c','d','d','d','d'];
        var thing ={};
        for (var i = 0;i<arr.length;i++){
           var value = arr[i];
           if(thing[value]){
            thing[value]++;
            }else{
            thing[value] = 1; 
            }   
        }
        console.log(thing);



//   var duixiang = {};
//   var value = 2;
//   var age = "年龄";
//   var value1 = 18;
//   duixiang[age] = value1;
//   console.log(duixiang);
    </script>
</body>